<template>
  <div>
    <nut-textinput 
            v-model="valname"
            label="您的姓名："
            placeholder="请输入姓名"
            maxlength="6"
            :clearBtn="true"
            :disabled="false"
            @blur="onBlur"
          />
    <nut-textinput 
        v-model="valphone"
        label="电话号码："
        placeholder="请输入手机号"
        maxlength="11"
        :clearBtn="true"
        :disabled="false"
        @blur="onBlurs" 
      />
      <span class="span_sex">性别：</span>
      <van-radio-group v-model="radio" @change="radios" class="radios" direction="horizontal">
        <van-radio name="1">男</van-radio>
        <van-radio name="2">女</van-radio>
      </van-radio-group>
  </div>
</template>



<script>
export default {
  data() {
    return {
      //用户信息
        valname: '',
        valphone: '',
        // arrjz:[],
        radio: "",
    }
  },
  methods: {
    onBlur(){
      let jzName = this.$store.state.arrjzName;
      jzName.push(this.valname)
      // console.log(jzName)
    },
    onBlurs(){
      let reg = /^1[3|4|5|7|8][0-9]{9}$/;
      let result = reg.test(this.valphone)
      let jzPhone = this.$store.state.arrjzPhone;
      if(result){
        jzPhone.push(this.valphone)
        // console.log(jzPhone)
        return true
      }
    },
    radios(){
      let jzSex = this.$store.state.arrjzSex;
      let sex = '';
      if(this.radio==1){
        sex='男'
      }else{
        sex='女'
      }
      jzSex.push(sex);
      // console.log(jzSex)
    }
  },
}
</script>



<style scoped>

</style>
